package com.irdstudio.basic.sequence.service.impl.support.segment.segment.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;

import com.irdstudio.basic.sequence.service.impl.support.segment.segment.dao.IDAllocDao;
import com.irdstudio.basic.sequence.service.impl.support.segment.segment.dao.IDAllocMapper;
import com.irdstudio.basic.sequence.service.impl.support.segment.segment.model.LeafAlloc;

import java.util.List;

public class IDAllocDaoImpl implements IDAllocDao {

    @Autowired
    private IDAllocMapper mapper;

    @Override
    public List<LeafAlloc> getAllLeafAllocs() {
        return mapper.getAllLeafAllocs();
    }

    @Override
    public LeafAlloc updateMaxIdAndGetLeafAlloc(String tag) {
        mapper.updateMaxId(tag);
        LeafAlloc ret = mapper.getLeafAlloc(tag);
        return ret;
    }

    @Override
    public LeafAlloc updateMaxIdByCustomStepAndGetLeafAlloc(LeafAlloc leafAlloc) {
        mapper.updateMaxIdByCustomStep(leafAlloc.getStep(), leafAlloc.getKey());
        LeafAlloc ret = mapper.getLeafAlloc(leafAlloc.getKey());
        return ret;
    }

    @Override
    public List<String> getAllTags() {
        return mapper.getAllTags();
    }
}
